﻿Imports System.Data
Imports System.Data.OleDb
Imports ADOEntityKYC

Partial Class KYC_IndividualReasonPopup
    Inherits System.Web.UI.Page

    Dim dtReason As New DataTable
    Dim KYCEntity As KYCEntities = New KYCEntities
    Dim CustSeq As Integer = 0

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            CustSeq = Request.QueryString("CUSTSEQ")

            Bind_Data_togrid_Reason()
        End If
    End Sub

    Sub Bind_Data_togrid_Reason()

        '''' Connect Data to Grid '''''''''''
        Me.dtReason.Columns.Add("REASONS")
        Me.dtReason.Columns.Add("USER_CREATED_DATE")
        Me.dtReason.Columns.Add("USER_CREATED_BY")
        Me.dtReason.Columns.Add("ACTIVE")

        Dim lvsCustType As Integer = Session("KYC")

        Dim qryReason = (From tbName In KYCEntity.MCUST_REASON
                        Where tbName.CUSTSEQ = CustSeq
                       Select tbName.SEQ,
                              tbName.USER_CREATED_DATE,
                              tbName.USER_CREATED_BY,
                              tbName.REASONS,
                              ACTIVE = If(tbName.ACTIVE = "Y", True, False)
                     Order By SEQ)

        For Each mRow In qryReason
            Me.dtReason.Rows.Add(mRow.REASONS,
                                 mRow.USER_CREATED_DATE,
                                 mRow.USER_CREATED_BY,
                                 mRow.ACTIVE)

            Me.dtReason.AcceptChanges()
        Next

        Me.grdReason.DataSource = Me.dtReason
        Me.grdReason.DataBind()
        ''''Number of Rows''''''''''''''''''''''''''''''
        Me.lblCount_Reason.Text = Me.dtReason.Rows.Count
        ''''''''''''''''''''''''''''''''''''''''''''''''
        Session("PopReason") = Me.dtReason

    End Sub

End Class
